package com.tjn.collection_;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @author 陶镓妮
 * @version 1.0
 * 增强For循环
 */
public class CollectionFor {
    public static void main(String[] args) {
        //增强for循环可以替代iterator迭代器，本质是一样的，使用增强for也会调用iterator迭代器
        Collection col = new ArrayList();
        col.add(new Book("西游记","吴承恩",100));
        col.add(new Book("红楼梦","曹雪芹",100));
        col.add(new Book("三国演义","罗贯中",100));
        col.add(new Book("水浒传","施耐庵",100));

        //增强for的快捷键是I
        for (Object book : col) {
            System.out.println(book);

        }

    }
}
